package a07_二叉树;

/**
 * <p>
 * a06_翻转二叉树复习3
 * </p>
 *
 * @author flyduck
 * @since 2025/4/7
 */
public class a06_翻转二叉树复习3 {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;

        invertTree(root.left);
        invertTree(root.right);
        return root;
    }
}
